# Maintainer: Christian Heusel <christian@heusel.eu>
# Contributor: Sanjay Pavan <withercubes@protonmail.com>

pkgname=nsxiv
pkgver=32
pkgrel=1
pkgdesc='Neo (or New or Not) Simple (or Small or Suckless) X Image Viewer'
arch=('loong64' 'x86_64')
license=('GPL2')
url='https://nsxiv.codeberg.page/'

depends=('imlib2' 'libx11'                 # core dependencies
         'libxft' 'fontconfig' 'freetype2' # status bar
         'libexif'                         # display exif images
         'hicolor-icon-theme')             # make icon

source=("$pkgname-$pkgver.tar.gz"::"https://codeberg.org/nsxiv/nsxiv/archive/v$pkgver.tar.gz")
sha256sums=('09d1d72b3cbcf17a04e26beb5e81acc9495aaba1f8f1be907bdcd8e4e3007db3')

prepare() {
  cd "$pkgname"
  [ ! -f config.h ] && cp config.def.h config.h
  # make install currently also runs make all
  # see https://codeberg.org/nsxiv/nsxiv-record/issues/237
  sed -i -e '/^install: / s|: all|:|' Makefile
}

build() {
  make -C "$pkgname" HAVE_INOTIFY=1 HAVE_LIBFONT=1 HAVE_LIBEXIF=1
}

package() {
  make -C "$pkgname" PREFIX=/usr DESTDIR="$pkgdir" install-all
}
